﻿using Newtonsoft.Json;

namespace 系统中间件.Session扩展
{
    public  static class SessionExtend
    {
        public static void Set<T>(this ISession session, string key, T obj)
        {
            session.SetString(key, JsonConvert.SerializeObject(obj));
        }

        public static T  Get<T>(this ISession session, string key)
        {
            return JsonConvert.DeserializeObject<T>(session.GetString(key));
        }
    }
}
